unit PythonImport;

// Module definition and import interface

interface
uses PythonTypes;

function PyImport_GetMagicNumber(): Long; cdecl; external; 
function PyImport_ExecCodeModule(name: PChar; co: PyObjectPtr): PyObjectPtr; cdecl; external;
function PyImport_ExecCodeModuleEx(name: PChar; co: PyObjectPtr; pathName: PChar): PyObjectPtr; cdecl; external;
function PyImport_GetModuleDict(): PyObjectPtr; cdecl; external;
function PyImport_AddModule(name: PChar): PyObjectPtr; cdecl; external;
function PyImport_ImportModule(name: PChar): PyObjectPtr; cdecl; external;
function PyImport_ImportModuleLevel(name: PChar; globals, locals, fromlist: PyObjectPtr; level: Integer): PyObjectPtr; cdecl; external;

// For DLL compatibility
// #undef PyImport_ImportModuleEx
function PyImport_ImportModuleEx(name: PChar; globals, locals, fromList: PyObjectPtr): PyObjectPtr; cdecl; external;
// #define PyImport_ImportModuleEx(n, g, l, f) \
//  PyImport_ImportModuleLevel(n, g, l, f, -1)

function  PyImport_Import(name: PyObjectPtr): PyObjectPtr; cdecl; external;
function  PyImport_ReloadModule(m: PyObjectPtr): PyObjectPtr; cdecl; external;
procedure PyImport_Cleanup(); cdecl; external;
function  PyImport_ImportFrozenModule(m: PChar): Integer; cdecl; external;

//function struct filedescr *) _PyImport_FindModule(const PChar , PyObjectPtr , PChar , size_t, FILE **, PyObjectPtr *);
//function _PyImport_IsScript(struct filedescr *): Integer; cdecl; external;
procedure _PyImport_ReInitLock(); cdecl; external;

function _PyImport_FindExtension(s1, s2: PChar): PyObjectPtr; cdecl; external;
function _PyImport_FixupExtension(s1, s2: PChar): PyObjectPtr; cdecl; external;

// struct _inittab {
//     PChar name;
//     void (*initfunc)(void);
// };
// 
// PyAPI_DATA(struct _inittab *) PyImport_Inittab;

// function int) PyImport_AppendInittab(PChar name, void (*initfunc)(void));
// function int) PyImport_ExtendInittab(struct _inittab *newtab);

// struct _frozen {
//     PChar name;
//     unsigned PChar code;
//     int size;
// };
// 
//  //  Embedding apps may change this pointer to point to their favorite
//  //   collection of frozen modules:
// 
// PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;

implementation

end.
